import java.util.ArrayList;
import java.util.Iterator;
import java.util.Vector;
import java.util.regex.Pattern;

import com.aliasi.coref.Matcher;
import com.aliasi.tokenizer.NGramTokenizerFactory;
import com.aliasi.tokenizer.Tokenizer;

public class  test
{
	
 public static void main(String args[])
 {
	 String a = "interceptor interceptors";
	 char b[] = a.toCharArray();
	 test t =  new test();
	 general_fun gf = new general_fun();
	 a=gf.remove_stop_words(a);
	 System.out.println("Output="+a);
	 a = gf.apply_stemming(a);
	 
	 
	System.out.println("A="+a);
	
	//general_fun gf = new  general_fun();
	
 }
}

/*
public class test
{

	
	public String humaniseCamelCase(String word) {
	    Pattern pattern = Pattern.compile("([A-Z]|[a-z])[a-z]*");

	    Vector<String> tokens = new Vector<String>();
	    java.util.regex.Matcher matcher = pattern.matcher(word);
	    String acronym = "";
	    while(matcher.find()) {
	        String found = matcher.group();
	        if(found.matches("^[A-Z]$")) {
	            acronym += found;
	        } else {
	            if(acronym.length() > 0) {
	                //we have an acronym to add before we continue
	                tokens.add(acronym);
	                acronym  = "";
	            }
	            tokens.add(found.toLowerCase());
	        }
	    }
	    if(acronym.length() > 0) {
	        tokens.add(acronym);
	    }
	    if (tokens.size() > 0) {
	        String humanisedString = make_first_letter_capital(tokens.remove(0));
	        for (String s : tokens) {
	            humanisedString +=  " " + s;
	        }
	        return humanisedString;
	    }

	    return word;
	}
	
	public String make_first_letter_capital(String input)
	{
		String first_cap = input.substring(0, 1).toUpperCase() +input.substring(1);
		//first_cap  = ""+input.charAt(0);
		//first_cap  = first_cap.toUpperCase()+input.substring(1);
		
		return first_cap;
	}
	
	public static void main(String args[])
	{
		String abc=  "RelationshipMBeanProxyFactory.java";
		test t =  new test();
		//String out = t.make_first_letter_capital(abc);
		//System.out.println("Out= "+out);
	   String out=	t.humaniseCamelCase(abc);
	   System.out.println("out="+out);
		
	}
}


/*
public class test
{
	

	
  public static void main(String args[])
  {
	  int abc = 1;
	  int bcd = 2;
	  bcd+=abc;
	  System.out.println("bcd="+bcd);
	  
	  String a="1234 12";
	  String b="12 34";
	 
	  general_fun gf =  new general_fun();
	  
	  String a1[]=gf.ngram(a, 2, 4);
	  String b1[]=gf.ngram(b, 2, 4);
	  
	  
	  Vector<ngram_and_frq> unique1 =  new Vector<ngram_and_frq>();
	  Vector<ngram_and_frq> unique2 =  new Vector<ngram_and_frq>();
	  
	  utility u =  new utility();
	  unique1 =  u.cal_unique_ngram_with_frq(a1);
	  unique2 = u.cal_unique_ngram_with_frq(b1);
	  
	  for(int i=0;i<unique1.size();i++)
	  {
		  System.out.println("un="+unique1.get(i).ngram+" frq="+unique1.get(i).frq);
	  }
	  
	  System.out.println("------------------------------------------------------");
	  for(int i=0;i<unique2.size();i++)
	  {
		  System.out.println("un="+unique2.get(i).ngram+" frq="+unique2.get(i).frq);
	  }
	  
	  test t =  new test();
	  h4_opt h =  new h4_opt();
	
	  double r2=1.0;
	  
	  //System.out.println("r2="+r);
	  
	  if(r2!=0)
	  r2 =u.normalize(r2, unique1, unique2);
	  
	  System.out.println("Normalized(r2)="+r2);
	  

	  
  }

}


/*
public class test
{
	
 public static void main(String args[])
 {
	 int count = 0;
	 int i =1;
	 while(i==1)
	 {
		 count++;
		 if(count==2)
		 {
			 break;
		 }
		 System.out.println("count="+count);
	 }//wh
	 
	 System.out.println("test="+"cleared");
	 String file_name =  "abc.java";
	 file_name = file_name.replace(".java", "_");
	 System.out.println("new file="+file_name);
 }
}


/*
public class test
{
	public static void main(String args[])
	{
		test t =  new test();
		general_fun gf = new general_fun();
		
		String a = "I am sfdjangeeta I lojdfkve lord ram? whom you love.";
		String b = "I an noy sdjfggang but I also love ram. I like hijfhdjfm alot";
		
		String a_arr[] = gf.ngram(a, 3, 10);
		String b_arr[] = gf.ngram(b, 3, 10);
		
		double result2 = gf.similarity(a_arr, b_arr);
		double result1 = gf.opt_similarity(a_arr, b_arr);
		
		System.out.println("result2="+result2);
		System.out.println("result1="+result1);
		
	}

}


/*
public class  test
{

	public static void main(String args[])
	{
		ArrayList<String>  a = new ArrayList<String>();
		a.add("a");
		a.add("b");
		a.add("c");
		
		a.set(1, "new");
		
		for(int i=0;i<a.size();i++)
		{
			System.out.println("i="+a.get(i));
		}
	}
} 


/*
public class test
{
	
 public static void main(String args[])
 {
	 int count = 0;
	 int i =1;
	 while(i==1)
	 {
		 count++;
		 if(count==2)
		 {
			 break;
		 }
		 System.out.println("count="+count);
	 }//wh
	 
	 System.out.println("test="+"cleared");
	 String file_name =  "abc.java";
	 file_name = file_name.replaceAll("\\.", "_");
	 System.out.println("new file="+file_name);
 }
}


/*
class test
{
	
  public static void main(String args[])
  {
	  
	  String a = "security ";
	  String b =  "2 Security Identity";
	  test t =  new test(); 
	  int result = t.commonCharacterNGrams(a, b) ;
	  
  }
  
  /*
  public int commonCharacterNGrams(String a, String b)
  {
  	
  	    System.out.println("---------------------------------");
  		int result = 0;
  		String[] aNgrams = ngram(a);

  		String[] bNgrams = ngram(b);
  		
          int count=0;
  		for(int i=0;i<aNgrams.length;i++)
  		{
  			String x = aNgrams[i];

  			for(int j=0;j<bNgrams.length;j++)
  				{
  					String y = bNgrams[j];

  						if(x.equalsIgnoreCase(y))
  						{
  						    count++;
  							System.out.println("count="+count+" "+x + " : " + y);
  						    result = result + 1;
  						}
  				}
  		}//for

  	System.out.println("Result = "+result);	
  	System.out.println("----------------------------------");	
  		return result;
  }

  
  public String[] ngram(String inputText)
  {
  		String[] result =new String[0];
  		
  		NGramTokenizerFactory ngtf =new NGramTokenizerFactory(3,10);
  		Tokenizer tokenizer = ngtf.tokenizer(inputText.toCharArray(), 0, inputText.length());

  		Iterator<String> iterator = tokenizer.iterator();

  		result = tokenizer.tokenize();

  		/*
  		System.out.println(result.length);

  		for(int i=0;i<result.length;i++){

  		System.out.println((i+1) + " : " + result[i]);

  		}

  		*/

  		/*
  		while(iterator.hasNext()){

  		String token = (String)iterator.next();

  		System.out.println(token);

  		}

  		

  		return result;
  }
  
  
}//class


*/

/*

class test
{
  public static void main(String args[])
  {
	  String pattern = "(\\s+[a-zA-Z]\\s+ )";
	    Pattern r = Pattern.compile(pattern);
	    String  cleanContent="Hi I am Sangeeta g hh k llllll u    j ";
		java.util.regex.Matcher m = r.matcher(cleanContent);
	    while(m.find()) 
	    {
	    	String s = m.group(0);
	    	
	    } 
	    
	    cleanContent.replaceAll("\\s+", " ");
	    cleanContent =  cleanContent.replaceAll("\\s+[a-zA-Z]\\s+", " ");
	    System.out.println(cleanContent);
	  
  }

}
*/

/*
class test
{

public static void main(String args[])
{
  String a =  "fname.java";
  System.out.println(a.endsWith(".java"));
}
}*/


/*import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

import org.apache.commons.codec.binary.Base64;



import 

java.util.*;
import

com.aliasi.classify.*;
import

com.aliasi.tokenizer.*;
import

com.aliasi.util.*;
public class test {
public void process(){
try{
IndoEuropeanTokenizerFactory ietf = IndoEuropeanTokenizerFactory.INSTANCE;
Set<String> cats = CollectionUtils.asSet("his","hers");
TradNaiveBayesClassifier classifier =new TradNaiveBayesClassifier(cats,ietf);
Classification hisCl =new Classification("his");
classifier.handle(new Classified<CharSequence>("haw hee haw",hisCl));
classifier.handle(new Classified<CharSequence>("haw haw",hisCl));
classifier.handle(new Classified<CharSequence>("haw",hisCl));
Classification hersCl =new Classification("hers");
classifier.handle(new Classified<CharSequence>("haw hee",hersCl));
classifier.handle(new Classified<CharSequence>("hee hee hee haw",hersCl));
classifier.handle(new Classified<CharSequence>("haw",hersCl));
System.out.println("Probability estimate for category his : " + classifier.probCat("his"));
System.out.println("Probability estimate for category hers : " + classifier.probCat("hers"));
System.out.println(classifier.probToken("hee", "his"));
System.out.println(classifier.probToken("haw", "his"));
System.out.println(classifier.probToken("hee", "hers"));
System.out.println(classifier.probToken("haw", "hers"));
System.out.println("");
}catch(Exception e)
{e.printStackTrace();}
}
}
/*
public class test
{
  public static void main(String args[])
  {
	  String t="jfkgfkfk'gjfkgjfg";
	  t=t.replaceAll("'", "a");
	  System.out.println("t="+t);
	  
  }
}*/

/*
public class test 
{

	public static void main(String args[])
	{
		//URL url=new URL("view-source:https://issues.jboss.org/browse/JBAS-7470?page=com.atlassian.jira.plugin.system.issuetabpanels%3Achangehistory-tabpanel#issue-tabs");
		try {
				String webPage = "https://issues.jboss.org/browse/JBAS-7470?page=com.atlassian.jira.plugin.system.issuetabpanels%3Achangehistory-tabpanel#issue-tabs";
				//String name = "admin";
				//String password = "admin";

				String authString = "sangeetalal" + ":" + "iiitd123";
				System.out.println("auth string: " + authString);
				byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
				String authStringEnc = new String(authEncBytes);
				System.out.println("Base64 encoded auth string: " + authStringEnc);

				URL url = new URL(webPage);
				URLConnection urlConnection = url.openConnection();
				urlConnection.setRequestProperty("Authorization", "Basic " + authStringEnc);
				InputStream is = urlConnection.getInputStream();
				InputStreamReader isr = new InputStreamReader(is);

				int numCharsRead;
				char[] charArray = new char[1024];
				StringBuffer sb = new StringBuffer();
				while ((numCharsRead = isr.read(charArray)) > 0) {
					sb.append(charArray, 0, numCharsRead);
					}
				String result = sb.toString();

				System.out.println("*** BEGIN ***");
				System.out.println(result);
				System.out.println("*** END ***");
			} catch (MalformedURLException e) 
			{
				e.printStackTrace();
			} 
			catch (IOException e) 
			{
				e.printStackTrace();
			}
		
	}

}*/